package com.lc.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lc.bean.Goods;
import com.lc.mapper.GoodsMapper;
import com.lc.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GoodsServiceImpl implements GoodsService {

    @Autowired
    GoodsMapper goodsMapper;

    @Override
    public PageInfo list(Goods goods, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);

        List<Goods> godsList = goodsMapper.list(goods);
        return new PageInfo(godsList);
    }

    @Override
    public void del(Integer id) {
        goodsMapper.del(id);
    }

    @Override
    public void save(Goods goods) {
        goodsMapper.save(goods);
    }

    @Override
    public Goods findById(Integer id) {
        return goodsMapper.findById(id);
    }

    @Override
    public void update(Goods goods) {
        goodsMapper.update(goods);
    }
}
